home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / hcsvga12.zip / HCGIFV.C < prev    next >
C/C++ Source or Header  |  1992-01-08  |  1KB  |  79 lines

  1. /*
  2.  * HCGIFV.C
  3.  *
  4.  * Copyright 1990,1991 Synergrafix Consulting
  5.  *          All Rights Reserved.
  6.  *
  7.  * December 31,1991
  8.  *
  9.  */
  10.  
  11. #include <stdio.h>
  12. #include "hcgif.h"
  13.  
  14. char infilename[128];
  15. char errmsg[256];
  16.  
  17. void error(char *s) {
  18.     fcloseall();
  19.     hctextmode();
  20.     printf("%s\n",s);
  21.     exit(1);
  22.     }
  23.  
  24. int main(int argc,char *argv[]) {
  25.  
  26.     int err,mode,w,h;
  27.  
  28.     if (argc!=2)
  29.         error("Usage: HCVTGA tgafilename");
  30.  
  31.     strcpy(infilename,argv[1]);
  32.  
  33.                         /* Get size of GIF file */
  34.  
  35.     err=hcgifsize(infilename,&w,&h,0L);
  36.     switch (err) {
  37.         case HCGIFCANTOPEN:
  38.             error("Can't open input file!");
  39.             break;
  40.         case HCGIFNOMEM:
  41.             error("Not enough memory to load file!");
  42.         case HCGIFNOTGIF:
  43.             error("Not a GIF File!");
  44.         case HCGIFBADGIF:
  45.             error("Error reading file!");
  46.         }
  47.  
  48.                         /* Set Hicolor mode */
  49.     mode=hcmodesize(w,h);
  50.     if (mode<2) mode=2;
  51.     if (mode>3) mode=3;
  52.     if (!hcsetmodetseng(mode))
  53.         error("No HiColor DAC, not Tseng Chipset, or can't set mode!");
  54.  
  55.  
  56.                         /* View GIF file */
  57.  
  58.     err=hcgifview(infilename,-1,-1,0L,1);
  59.     switch (err) {
  60.         case HCGIFCANTOPEN:
  61.             error("Can't open input file!");
  62.             break;
  63.         case HCGIFNOMEM:
  64.             error("Not enough memory to load file!");
  65.         case HCGIFNOTGIF:
  66.             error("Not a GIF File!");
  67.         case HCGIFBADGIF:
  68.             error("Error reading file!");
  69.         }
  70.  
  71.     getch();                               /* Exit */
  72.  
  73.     hctextmode();
  74.  
  75.     return 0;
  76.     }
  77.  
  78.  
  79.